package holder;

import com.example.googlemarketdemo.R;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

import utils.UIUtils;
import android.view.View;
import android.widget.LinearLayout;
import base.BaseHolder;

/**
 * 加载更多的holder
 * @author Anson-pc
 *
 */
public class LoadMoreHolder extends BaseHolder<Integer>{
	@ViewInject(R.id.item_loadmore_container_loading)
	LinearLayout mContainerLoading;
	@ViewInject(R.id.item_loadmore_container_retry)
	LinearLayout mContainerRetry;
	
	public  static final int LOADING_MORE = 0;
	public  static final int LOADING_RETRY = 1;
	public  static final int LOADING_NONE = 2;
	@Override
	protected View initHolderView() {
		View rootView = View.inflate(UIUtils.getContext(), R.layout.item_load_more, null);
		ViewUtils.inject(this, rootView);
		return rootView;
	}

	@Override
	protected void refreshHolderView(Integer curState) {
		//先隐藏视图
		mContainerLoading.setVisibility(8);
		mContainerRetry.setVisibility(8);
		
		
		switch (curState) {
		case LOADING_MORE://显示加载视图
			mContainerLoading.setVisibility(0);
			break;
case LOADING_RETRY://显示重试视图
	mContainerRetry.setVisibility(0);
			break;
case LOADING_NONE://不显示
	
	break;

		default:
			break;
		}
	}

}
